// 处理全局注册的组件
import SvgComponent from '@/components/SvgIcon/index.vue'
import Pagination from '@/components/Pagination/index.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const components = { SvgComponent, Pagination }
export default {
  //当app.use执行的时候就会触发install函数，并传递app参数
  install(app: any) {
    Object.keys(components).forEach((key) => {
      // @ts-expect-error ts报类型错误
      app.component(key, components[key])
    })
    // Object.entries 是生成一个数组对象 [key,component(icon图标的组件)]
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
